import { Controller, Get, Post, Body, Patch, Param, Delete, Query, Put } from "@nestjs/common";
import { DictionaryDataService, DictionaryService } from "./dictionary.service";
import { CreateDictionaryDto } from './dto/create-dictionary.dto';
import { UpdateDictionaryDto } from './dto/update-dictionary.dto';
import { FindDictionaryDataDto, FindDictionaryDto } from "./dto/find-dictionary.dto";
import { DeleteIds } from "../dto/all-dto";
import { CreateDemoReDto } from "../demo-res/dto/create-demo-re.dto";
import { UpdateDemoReDto } from "../demo-res/dto/update-demo-re.dto";

@Controller('dictionary')
export class DictionaryController {
  constructor(private readonly dictionaryService: DictionaryService) {}

  @Post()
  create(@Body() createDictionaryDto: CreateDictionaryDto) {
    return this.dictionaryService.create(createDictionaryDto);
  }

  @Get()
  findAll(@Query() findDictionaryDto  : FindDictionaryDto) {
    return this.dictionaryService.findAll(findDictionaryDto);
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.dictionaryService.findOne(+id);
  }

  @Put()
  update(@Body() updateDictionaryDto: UpdateDictionaryDto) {
    return this.dictionaryService.update(updateDictionaryDto);
  }

  @Delete()
  remove(@Body() deleteIds: DeleteIds) {
    return this.dictionaryService.remove(deleteIds);
  }
}
@Controller('dictionaryData')
export class DictionaryDataController {
  constructor(
    private readonly dictionaryDataService: DictionaryDataService
  ) {}

  @Post()
  create(@Body() createDemoReDto: CreateDemoReDto) {
    return this.dictionaryDataService.create(createDemoReDto);
  }

  @Get()
  findAll(@Query() findDictionaryDataDto: FindDictionaryDataDto) {
    return this.dictionaryDataService.findAll(findDictionaryDataDto);
  }

  @Get(':id')
  findOne(@Param('id') id: number) {
    return id
    // return this.dictionaryDataService.findOne(code);
  }

  @Put()
  update(@Body() updateDemoReDto: UpdateDemoReDto) {
    return this.dictionaryDataService.update(updateDemoReDto);
  }

  @Delete()
  remove(@Body() deleteIds: DeleteIds) {
    return this.dictionaryDataService.remove(deleteIds);
  }
}